window.onload = function() {

    axios.defaults.baseURL = "https://autumnfish.cn";


    var app = new Vue({


        el: "#app",
        data() {
            return {
                title: "悦 听 demo",
                search: '漫步人生路',
                musicURL: '',
                mvurl: null,
                musicid: null,
                img: '',
                comments: [],
                nomask: {
                    display: "none"
                },
                offmask: {
                    display: "block"
                },
                isshow: false
            }
        },
        methods: {
            getmusic() {

                var that = this;

                if (this.search == '') {
                    return false;
                }
                axios.get('/search', {
                    params: {
                        keywords: this.search
                    }
                }).then(function(res) {
                    that.musicid = res.data.result.songs;

                })
            },
            playermusic(id) {
                var that = this;
                axios.get('/song/url', {
                    params: {
                        id: id
                    }
                }).then(function(res) {
                    that.musicURL = res.data.data[0].url;
                });

                axios.get('/song/detail', {
                    params: {
                        ids: id
                    }
                }).then(function(res) {

                    that.img = res.data.songs[0].al.picUrl

                });

                axios.get('/comment/hot?type=0', {
                    params: {
                        id: id
                    }
                }).then(function(res) {

                    that.comments = res.data.hotComments;
                    console.log(that.comments);

                })
            },


            playermv(id) {
                var that = this;
                axios.get('/mv/url', {
                    params: {
                        id: id
                    }
                }).then(function(res) {
                    that.mvurl = res.data.data.url;
                })
            },
            clearmask() {
                this.mvurl = "";
            },

            // 音乐暂停 动画
            play() {
                this.isshow = true
            },

            // 音乐开始 动画
            pause() {
                this.isshow = false

            }
        }

    })





}